<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <title>橘子网课答案查询 - 最便捷的大学网课答案在线查询网站</title>
    <meta name="keywords" content="橘子网课答案查询,橘子网课查题小程序,橘子校园查题公众号"/>
    <meta itemprop="description" name="description"
          content="橘子网课答案查询(www.orangewangke.cn)提供简单便捷的大学超星尔雅、知到智慧树网课答案查询服务。让您的大学网课查题更简单。"/>
    <meta itemprop="name" content="橘子网课答案查询 - 最便捷的网课查询网站"/>
    <meta itemprop="image" content="/images/wechat.png"/>
    <meta property="og:image" content="/images/wechat.png"/>
    <link rel="stylesheet" type="text/css" media="screen" href="/me/style.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="/me/1.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="/layui/css/layui.css"/>
    <link rel="shortcut icon" href="favicon.ico">
</head>
<body style="height: auto">
<div class="header">
    <ul class="layui-nav">
        <li class="layui-nav-item float-right" th:if="${user!=null}">
            <a href="javascript: info()"><img th:src="${user.avatar_url}" class="layui-nav-img">&nbsp;<span
                    th:text="${user.nickname}"></span></a>
            <dl class="layui-nav-child" style="text-align: center">
                <dd><a href="javascript:">修改信息</a></dd>
                <dd><a href="javascript:">安全管理</a></dd>
                <dd><a th:href="@{/signout}">退出登录</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item float-right" th:if="${user==null}">
            <a href="javascript: sign()"><img src="/images/default.png" class="layui-nav-img" alt="">游客登录<span
                    class="layui-badge-dot"></span></a>
        </li>
        <li class="layui-nav-item float-right">
            <a href="">充值</a>
        </li>
        <li class="layui-nav-item float-right layui-hide-mm">
            <a href="">使用说明<span class="layui-badge-dot" th:if="true"></span></a>
        </li>
    </ul>
</div>

<div class="container" style="top:100px;">
    <div class="main">
        <div class="content-body">
            <!-- 左侧 -->
            <div class="content-left">
                <div class="avatar">
                    <img src="/images/wechat.png" alt="">
                </div>
                <div class="device">
                    <p class="name">橘子查题</p>
                    <p class="qq">更多答案请关注【橘子校园查题】微信公众号查询</p>
                </div>
            </div>
            <!-- 右侧 -->
            <div class="content-right">
                <div class="content index">
                    <div class="index-box">
                        <div class="container">
                            <div class="main">
                                <div class="content-body">
                                    <!-- 左侧 -->

                                    <!-- 右侧 -->
                                    <div class="content-right">
                                        <div class="title">网课答案查询</div>
                                        <div class="content">
                                            <div class="content-box">
                                                <div class="content-key">
                                                    <input type="text" name="keyword" id="url" placeholder="输入题目"
                                                           lay-verify="required">
                                                </div>
                                                <button type="submit" id="ajax_key">查询</button>
                                            </div>
                                            <div id="tips"></div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="index-link">
                <div class="link-title"><h3>友情链接</h3></div>
                <ul>
                    <li><a href="http://wpa.qq.com/msgrd?v=3&uin=1950661299&site=qq&menu=yes" title="" target="_blank">联系客服</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <footer>
        <span class="footer-left">©&nbsp;2020 Copyright&nbsp;<a href="http://www.orangewangke.cn"
                                                                title="">橘子网课查题</a></span>
        <span class="footer-right">
				<a rel="nofollow" href="http://www.beian.miit.gov.cn/" target="_blank" title="">粤ICP备19149910号</a>
		    </span>
    </footer>
</div>
<script src="layui/jquery-3.0.0.min.js"></script>
<script src="layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['layer', 'form', 'element', 'jquery'], function () {
        const layer = layui.layer,
            $ = layui.jquery,
            form = layui.form,
            element = layui.element;
        form.render();
        $(document).keydown(function (event) {  //实现按Enter键提交表单
            if (event.keyCode == 13) {
                $('#ajax_key').trigger('click');
            }
        });
        $('#ajax_key').click(function () {
            var keyword = $('#url').val();
            if (keyword == '') {
                layer.msg("题目不能为空", {
                    icon: 2,
                    time: 1000
                }, function () {
                    $("#url").focus()
                });
                return false;
            }
            $.ajax({
                url: "search/cx",
                type: "POST",
                dataType: "json",
                data: "problem=" + $.trim($("#url").val()),
                success: function (res) {
                    var data = res.data;
                    var oDiv = document.getElementById('tips');
                    if (res.code !== 1) {
                        oDiv.innerHTML = '<div class="tips"><h1>温馨提示：<span class="color">' + res.msg + '</span></h1></div>';
                        $("#url").val('')
                        return false;
                    }
                    data.forEach(function (value) {
                        var left = /</g;
                        var right = />/g;
                        var problem = value.problem.replace(left, '&lt;');
                        problem = problem.replace(right, '&gt;');
                        var xx = value.xx.replace(left, '&lt;');
                        xx = xx.replace(right, '&gt;');
                        var answer = value.answer.replace(left, '&lt;');
                        answer = answer.replace(right, '&gt;');
                        if (value.xx.length === 0)
                            oDiv.innerHTML = '<div class="tips"><h1>温馨提示：<span class="color">' + res.msg + '</span></h1><div class="tips-content"><li style="margin-bottom: 15px;"><pre>题目：' + problem + '</pre></li><li><pre>答案：' + answer + '</pre></li></div></div>';
                        else
                            oDiv.innerHTML = '<div class="tips"><h1>温馨提示：<span class="color">' + res.msg + '</span></h1><div class="tips-content"><li style="margin-bottom: 15px;"><pre>题目：' + problem + '</pre></li><li style="margin-bottom: 15px;"><pre>选项：' + xx + '</pre></li><li><pre>答案：' + answer + '</pre></li></div></div>';
                    })
                    $("#url").val('')
                    return false;
                },
                error: function () {
                    layer.msg('服务器请求失败', {icon: 2, shade: [0.5, '#000000'], shadeClose: true, time: 1000});
                    return false;
                }
            });
        });
        $(function () {
            layer.open({
                type: 1,
                title: false, //不显示标题栏
                closeBtn: false,
                area: '400px;',
                shade: 0.8,
                id: 'notice', //设定一个id，防止重复弹出
                btn: ['知道啦'],
                btnAlign: 'c',
                moveType: 0, //拖拽模式，0或者1
                content: '<div class="notice"><img src="/images/wechat.png" style="width:350px;height: 350px;" alt=""><br><br>关注我们的公众号，查题更便捷<br>千万级题库，题目更齐全</div>'
                , end: function () {
                    $('input[name=problem]').focus()
                }
            });
        });
        window.sign = function () {
            layer.open({
                type: 2,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: [350 + 'px', ' 45%'],
                content: ['/login', 'no'],
                success: function (layer, index) {
                }
            });
        };
        window.info = function () {
            layer.open({
                type: 2,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['50%', '50%'],
                content: ['/info', 'no'],
                success: function (layer, index) {
                }
            });
        }
    })
</script>
</body>
</html>